
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
 */
package supermarketgui.utils;

//~--- JDK imports ------------------------------------------------------------

import java.awt.*;

import java.util.Vector;

import javax.swing.*;

public class WideComboBox extends JComboBox {
    private boolean layingOut = false;

    public WideComboBox() {}

    public WideComboBox(ComboBoxModel aModel) {
        super(aModel);
    }

    public WideComboBox(final Object items[]) {
        super(items);
    }

    public WideComboBox(Vector items) {
        super(items);
    }

    public void doLayout() {
        try {
            layingOut = true;
            super.doLayout();
        } finally {
            layingOut = false;
        }
    }

    public Dimension getSize() {
        Dimension dim = super.getSize();

        if (!layingOut) {
            dim.width = Math.max(dim.width, getPreferredSize().width);
        }

        return dim;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
